typedef struct AdResource
{
    int type_id;
    char * path;
    char * sign;
    int index;
    int ad_id;
    int id;
} AdResource;

typedef struct Ad
{
    int id;
    int index;
    char * start_time;
    char * end_time;
    int templateId;
    int customerId;
    AdResource *resources[3];
    
} Ad;

#define AD_DB_PATH "/home/xhb/ronghua-ads/ads.db"

int saveAd(Ad *ad);
int updateAd(Ad *ad);
Ad* getAd(int id);


int saveAr(AdResource *ar);
int updateAr(AdResource *ar);
AdResource* getAr(int adid,int index);

int clearExpireAd();